package com.coda.mapper;

import com.coda.annotation.AutoFill;
import com.coda.entity.LabelInfo;
import com.coda.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface LabelMapper {
    /**
     * 新增标签
     * @param labelInfo
     */
    @AutoFill(OperationType.INSERT)
    void insert(LabelInfo labelInfo);

    /**
     * 修改标签
     * @param labelInfo
     */
    @AutoFill(OperationType.UPDATE)
    void update(LabelInfo labelInfo);

    /**
     *查询标签列表
     * @return
     */
    @Select("select * from label_info")
    List<LabelInfo> list();

    /**
     * 根据id删除标签
     * @param id
     */
    @Delete("delete from label_info where id = #{id}")
    void delete(Long id);
}
